package com.focus.xyz.core.common.webdriver;

import org.openqa.selenium.Dimension;

/**
 * Created by chenmeng on 2016/7/25.
 */
public interface SeleConst {

    enum DeviceEnum{
        IPhone6("iphone6","Apple iPhone 6",new Dimension(375,667)),
        IPhone5("iphone5","Apple iPhone 5",new Dimension(320,568)),
        IPhone6P("iphone6p","Apple iPhone 6 Plus",new Dimension(414,736)),
        IPad("ipad","Apple iPad",new Dimension(1024,768)),
        DEFALUT("defalut","Apple iPhone 6",new Dimension(375,667));

        private String name;
        private String code;
        private Dimension size;
        DeviceEnum(String name,String code, Dimension size){
            this.name = name;
            this.code = code;
            this.size = size;
        }

        public String getCode() {
            return code;
        }

        public Dimension getSize() {
            return size;
        }

        public static DeviceEnum getDevice(String name) {
            for (DeviceEnum driverEnum : DeviceEnum.values()) {
                if (driverEnum.getCode().equals(name.toLowerCase())) {
                    return driverEnum;
                }
            }
            return DEFALUT;
        }
    }

    enum DriverEnum{
        IE("IEDriverServer.exe","ie"),
        CHROME("chromedriver-2.14.exe","chrome"),
        FIREFOX("","firefox"),
        HTMLUNIT("","htmlunit"),
        PHANTOMJS("phantomjs.exe","phantomjs"),
        SAFARI("","safari"),
        EDGE("","edge"),
        DEFULAT("chromedriver-2.14.exe","chrome");
        private String name;
        private String driver;
        private String code;
        DriverEnum(String driver,String code){
            this.driver = driver;
            this.code = code;
        }

        public static DriverEnum getEnum(String browser) {
            for (DriverEnum driverEnum : DriverEnum.values()) {
                if (driverEnum.getCode().equals(browser.toLowerCase())) {
                    return driverEnum;
                }
            }
            return DEFULAT;
        }

        public String getName() {
            return name;
        }

        public String getDriver() {
            return driver;
        }

        public String getCode() {
            return code;
        }

        public void setName(String name) {
            this.name = name;
        }

        public void setDriver(String driver) {
            this.driver = driver;
        }

        public void setCode(String code) {
            this.code = code;
        }
    }
}
